# coding=utf-8
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt


@csrf_exempt
def index(request):
    # return HttpResponse("hello word")
    error_msg = ''
    if request.method == 'POST':
        u = request.POST.get('selection', None)  # 获取前端html发送来的表单数据（根据name属性区分）
        # p = request.POST.get('password', None)
        print(u)
        if u == 'A':  # 数据判断
            return render(request, 'success.html')
        else:
            return render(request, 'fail.html')
    return render(request, 'index.html', {'error_msg': error_msg})
